package com.link.base.task;

import com.link.base.base.order.service.SaleOrderService;
import com.link.base.core.basic.config.xxljob.BaseLinkJobHandler;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 定时查询超时未支付的订单并关闭
 *
 * @author 路江
 * @date 2019-03-08
 */
@JobHandler(value = "orderCloseJobHandler")
@Component
public class TaskOrderClose extends BaseLinkJobHandler {

    @Resource
    private SaleOrderService saleOrderService;

    @Override
    public ReturnT<String> execute(String params) throws Exception {
        try {
            XxlJobLogger.log("XXL-JOB, Hello couponsJobHandler");
            super.setLogin(params);
            saleOrderService.queryOrder();
            return ReturnT.SUCCESS;
        } catch (Exception e) {
            XxlJobLogger.log(e.getMessage());
            return ReturnT.FAIL;
        }
    }
}
